ResultArg

@ApiStatus.Experimental
abstract class ResultArg<V, R> @JvmOverloads constructor(arg: String, fallback: R, noValueArg: Boolean = false)

A key for handling a scope argument for a ResultProvider

Author

fzzyhmstrs

Since

0.5.3

Parameters

V

the value type received by this arg for processing

R

the result type provided by processing

arg

String key used in the scope passed to the provider. for example a boolean arg "test" would have a scope my.example.scope?test=false

fallback

R a fallback value in case processing or argument parsing fails

noValueArg

Optional boolean, if true the scope string will not need an =value clause: my.example.scope?noValue?valueNeeded=true

Inheritors

Constructors

Link copied to clipboard
constructor(arg: String, fallback: R, noValueArg: Boolean = false)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@ApiStatus.Experimental
inner class Processor : ResultArg<V, R>

A ResultArg that calls a provided result consumer when the arg is applied. This is used in multi-arg result processing

Functions

Link copied to clipboard
@ApiStatus.Experimental
abstract fun applyArg(scopeValue: V, argValue: String): R

Applies the parsed arg value to a scoped config value and returns the processing result

Link copied to clipboard
@ApiStatus.Experimental
fun to(consumer: Consumer<R>): ResultArg.Processor<V, R>

Converts this ResultArg into a Processor of the same type that calls the provided consumer.